package com.minelx.woods.pc.service.mapper;

import com.minelx.httpclient.core.Requests;
import com.minelx.httpclient.core.request.IResponse;
import com.minelx.sqlstructures.common.Files;
import com.minelx.statementsplus.common.Templates;

import java.util.HashMap;
import java.util.Map;

public class TaskRequestMapper {
	public IResponse requestGetTask(String token, String taskId) {
		Map<String, String> parameters = new HashMap<>();
		parameters.put("token", token);
		parameters.put("taskId", taskId);
		return Requests.parse(new Templates(Files.toString("/requests/get_task.request")).render(parameters)).fetch();
	}

	public IResponse requestPostDownloadRequest(String token, String taskId) {
		Map<String, String> parameters = new HashMap<>();
		parameters.put("token", token);
		parameters.put("taskId", taskId);
		return Requests.parse(new Templates(Files.toString("/requests/post_download_request.request")).render(parameters)).fetch();
	}

	public IResponse requestDownloadTask(String token, String requestId) {
		Map<String, String> parameters = new HashMap<>();
		parameters.put("token", token);
		parameters.put("requestId", requestId);
		return Requests.parse(new Templates(Files.toString("/requests/get_download_task.request")).render(parameters)).fetch();
	}
}
